# -*- coding: utf-8 -*-
"""
Created on Sun Jun  9 00:16:53 2019

@author: Administrator
"""

def sphere(x):
    data = []
    if not isinstance(x, list):
        data.append(x)
    else:
        data = x
    result = 0
    for xi in data:
        result = result + xi ** 2
    return result

#print(sphere([-1]))

def schwefel2_22(x):
    data = []
    if not isinstance(x, list):
        data.append(x)
    else:
        data = x
    sum_result = 0
    product_result = 1
    for xi in data:
        sum_result = sum_result + abs(xi)
        product_result = product_result * abs(xi)
        
    return sum_result + product_result

#print(schwefel2_22([-1,1,2]))

